package com.hospital.demo.exception;

import com.hospital.demo.util.ResultUtils;
import com.hospital.demo.util.ResultVO;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;


/**
 * Description: 全局异常处理
 * Param:
 * return:
 * Author: zsq
 * Date: 2019/2/1 0001
 */
@ControllerAdvice
public class HandleHospitalException {

    @ExceptionHandler(HospitalException.class)
    @ResponseStatus(HttpStatus.OK)
    @ResponseBody
    public ResultVO handlerSellException(HospitalException e) {
        return ResultUtils.error(e.getCode() , e.getMessage());
    }
}
